package com.hmall.api.pay;


import com.hmall.api.pay.dto.PayOrderDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;

@Slf4j
public class PayClientFallbackFactory implements FallbackFactory<PayClient> {
    /**
     * 远程调用  如果远程调用跨服接口失败，则走这个方法  降级逻辑
     * @param cause
     * @return
     */
    @Override
    public PayClient create(Throwable cause) {
        return new PayClient() {
            @Override
            public PayOrderDTO queryPayOrderByBizOrderNo(Long id) {
                //todo
                System.out.println("[降级逻辑],根据订单id查询订单失败");
                return null;
            }
        };
    }
}